FROM intel-airflow:2.1

USER root

ENV PATH=/opt/software/starman:/opt/software/intel/bin:$PATH

RUN apt-get update && \
    apt install -y libpq-dev && \
    pip3 install psycopg2 && \
    rm -rf /var/lib/apt/lists/*

ENV AIRFLOW_USER airflow
USER $AIRFLOW_USER
COPY --chown=$AIRFLOW_USER efso /opt/efso

ENV NETCDF_ROOT=/opt/software/ifort
ENV ECCODES_ROOT=/opt/software/ifort
ENV FOX_ROOT=/opt/software/ifort
ENV LAPACK_ROOT=/opt/software/ifort
RUN ["/bin/bash","-c","cd /opt/efso/build && FC=mpiifort cmake .. && \
    make -j 10"]

COPY --chown=$AIRFLOW_USER ssh $AIRFLOW_HOME/.ssh
